<template>
  <BaseSearchForm v-model:search-param="checkParam"
    @goBack="emit('goto-edit')"
    @search="search">
  </BaseSearchForm>
  <div class="tableBox">
    <MkTable :data="list"
      border
      @row-dblclick="rowDbClick">
      <MkColumn label="单号"
        prop="billNo" />
      <MkColumn type="BillStatus"
        label="单据状态"
        prop="billStatus" />
      <MkColumn label="出库单编号"
        prop="bloodBank" />
      <MkColumn label="入库来源"
        prop="bloodStation" />
      <MkColumn label="开单时间"
        prop="createTime" />
    </MkTable>
    <div style="text-align: center; width: 100%;">
      <MkPagination v-model:page="checkParam.page"
        v-model:pageSize="checkParam.pageSize"
        :total="total"
        @query="search" />
    </div>
    
  </div>
</template>

<script lang='ts' setup>

//单表List基本操作
import useListMastControls from '/@/componentsMaike/basHook/useListMastControls'
import { InvAuditStockInMaster, InvAuditStockInDetail } from '/@/api/inv/invShouGong/dto'
import { SearchStockInDate } from '/@/api/inv/invShouGong';



const emit = defineEmits(['goto-edit'])
const { checkParam, 
  // total, list, search
 } = useListMastControls(SearchStockInDate);
const rowDbClick = (row: any) => {
  emit('goto-edit', row)
}


interface Bill {
  billNo: string;
  billStatus: string;
  storageWay: string;
  bloodStation: string;
  bloodBank: string;
  createTime: string;
  detail: InvAuditStockInDetail[];
}

const list = ref<Bill[]>([])
const alllist = ref<Bill[]>([])
  alllist.value = [
    {
      billNo: 'SIN250301003',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250301001',  // 3月1日单据
      createTime: '2025-03-01 10:00:00',
      detail: [
        {
          bloodDonationCode:'0201234567810',
          basBloodProductCode: 'B0022V00',
          basBloodVarietyId: 1,
          abo: 'B',
          rhD: '+',
          volume: 1,
          unit: 'u',
          price: 340,
          specialProcessing: '滤白',
          basBloodProductName: '去白细胞悬浮红细胞2u',
          basBloodVarietyName: '去白细胞悬浮红细胞',
          effectiveDate: '2025-3-1',
          gatheringDate: '2025-3-1',
          makeDate:  '2025-3-1',
        },
        {
        "bloodDonationCode": "0201234567816",
        "basBloodProductCode": "B0022V06",
        "basBloodVarietyId": 7,
        "abo": "B",
        "rhD": "+",
        "volume": 1.5,
        "unit": "u",
        "price": 600,
        "specialProcessing": "",
        "basBloodProductName": "洗涤红细胞2u",
        "basBloodVarietyName": "洗涤红细胞",
        "effectiveDate": "2025-3-4",
        "gatheringDate": "2025-3-4",
        "makeDate": "2025-3-4"
      },
        {
          "bloodDonationCode": "0201234567187",
          "basBloodProductCode": "B0022V07",
          "basBloodVarietyId": 8,
          "abo": "O",
          "rhD": "+",
          "volume": 0.5,
          "unit": "u",
          "price": 220,
          "specialProcessing": "",
          "basBloodProductName": "去甘油红细胞2u",
          "basBloodVarietyName": "去甘油红细胞",
          "effectiveDate": "2025-3-4",
          "gatheringDate": "2025-3-4",
          "makeDate": "2025-3-4"
        }
      ]
    },
    {
      billNo: 'SIN250301002',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250301002',  // 3月1日单据
      createTime: '2025-03-01 09:00:00',
      detail: [
        {
          bloodDonationCode: "0201234567180",
          basBloodProductCode: "B0022V00",
          basBloodVarietyId: 1,
          abo: "B",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 970,
          specialProcessing: "",
          basBloodProductName: "去白细胞悬浮红细胞2u",
          basBloodVarietyName: "去白细胞悬浮红细胞",
          effectiveDate: "2025-3-1",
          gatheringDate: "2025-3-1",
          makeDate: "2025-3-1"
        }
      ]
    },
    {
      billNo: 'SIN250301001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250301003',  // 3月1日单据
      createTime: '2025-03-01 08:00:00',
      detail: [
        {
          bloodDonationCode: "0201234562781",
          basBloodProductCode: "B0022V01",
          basBloodVarietyId: 2,
          abo: "A",
          rhD: "-",
          volume: 200,
          unit: "ml",
          price: 40,
          specialProcessing: "",
          basBloodProductName: "冰冻血浆200ml",
          basBloodVarietyName: "冰冻血浆",
          effectiveDate: "2025-3-2",
          gatheringDate: "2025-3-2",
          makeDate: "2025-3-2"
        },
        {
          bloodDonationCode: "0201234545462",
          basBloodProductCode: "B0022V02",
          basBloodVarietyId: 3,
          abo: "AB",
          rhD: "+",
          volume: 100,
          unit: "ml",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "新鲜冰冻血浆100ml",
          basBloodVarietyName: "新鲜冰冻血浆",
          effectiveDate: "2025-3-3",
          gatheringDate: "2025-3-3",
          makeDate: "2025-3-3"
        },
        {
          bloodDonationCode: "0201965586783",
          basBloodProductCode: "B0022V03",
          basBloodVarietyId: 4,
          abo: "O",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 1600,
          specialProcessing: "",
          basBloodProductName: "单采血小板2u",
          basBloodVarietyName: "单采血小板",
          effectiveDate: "2025-3-4",
          gatheringDate: "2025-3-4",
          makeDate: "2025-3-4"
        }
      ]
    },
    {
      billNo: 'SIN250228003',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250228001',  // 2月28日单据
      createTime: '2025-02-28 16:07:12',
      detail: [
        {
          bloodDonationCode: "0201123456782",
          basBloodProductCode: "B0022V02",
          basBloodVarietyId: 3,
          abo: "AB",
          rhD: "+",
          volume: 100,
          unit: "ml",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "新鲜冰冻血浆100ml",
          basBloodVarietyName: "新鲜冰冻血浆",
          effectiveDate: "2025-3-3",
          gatheringDate: "2025-3-3",
          makeDate: "2025-3-3"
        }
      ]
    },
    {
      billNo: 'SIN250228002',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250228002',  // 2月28日单据
      createTime: '2025-02-28 09:19:17',
      detail: [
        {
          bloodDonationCode: "0201234536783",
          basBloodProductCode: "B0022V03",
          basBloodVarietyId: 4,
          abo: "O",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "单采血小板2u",
          basBloodVarietyName: "单采血小板",
          effectiveDate: "2025-3-4",
          gatheringDate: "2025-3-4",
          makeDate: "2025-3-4"
        }
      ]
    },
    {
      billNo: 'SIN250228001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250228003',  // 2月28日单据
      createTime: '2025-02-28 21:41:49',
      detail: [
        {
          bloodDonationCode: "0201234586784",
          basBloodProductCode: "B0022V04",
          basBloodVarietyId: 5,
          abo: "A",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "手工分离浓缩血小板2u",
          basBloodVarietyName: "手工分离浓缩血小板",
          effectiveDate: "2025-3-5",
          gatheringDate: "2025-3-5",
          makeDate: "2025-3-5"
        }
      ]
    },
    {
      billNo: 'SIN250227001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250227001',  // 2月27日单据
      createTime: '2025-02-27 20:39:53',
      detail: [
        {
          bloodDonationCode: "0201234586785",
          basBloodProductCode: "B0022V05",
          basBloodVarietyId: 6,
          abo: "AB",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "冷沉淀凝血因子2u",
          basBloodVarietyName: "冷沉淀凝血因子",
          effectiveDate: "2025-3-6",
          gatheringDate: "2025-3-6",
          makeDate: "2025-3-6"
        }
      ]
    },
    {
      billNo: 'SIN250215001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250215001',  // 2月15日单据
      createTime: '2025-02-15 14:36:19',
      detail: [
        {
          bloodDonationCode: "0201234568786",
          basBloodProductCode: "B0022V06",
          basBloodVarietyId: 7,
          abo: "B",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "洗涤红细胞2u",
          basBloodVarietyName: "洗涤红细胞",
          effectiveDate: "2025-3-7",
          gatheringDate: "2025-3-7",
          makeDate: "2025-3-7"
        }
      ]
    },
    {
      billNo: 'SIN250213001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250213001',  // 2月13日单据
      createTime: '2025-02-13 09:23:47',
      detail: [
        {
          bloodDonationCode: "0201234856787",
          basBloodProductCode: "B0022V07",
          basBloodVarietyId: 8,
          abo: "O",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "去甘油红细胞2u",
          basBloodVarietyName: "去甘油红细胞",
          effectiveDate: "2025-3-8",
          gatheringDate: "2025-3-8",
          makeDate: "2025-3-8"
        }
      ]
    },
    {
      billNo: 'SIN250213002',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250213002',  // 2月13日单据
      createTime: '2025-02-13 16:41:25',
      detail: [
        {
          bloodDonationCode: "0201234567888",
          basBloodProductCode: "B0022V08",
          basBloodVarietyId: 9,
          abo: "A",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "全血2u",
          basBloodVarietyName: "全血",
          effectiveDate: "2025-3-9",
          gatheringDate: "2025-3-9",
          makeDate: "2025-3-9"
        }
      ]
    },
    {
      billNo: 'SIN250212001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250212001',  // 2月12日单据
      createTime: '2025-02-12 23:44:16',
      detail: [
        {
          bloodDonationCode: "0201234756789",
          basBloodProductCode: "B0022V00",
          basBloodVarietyId: 1,
          abo: "B",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "去白细胞悬浮红细胞2u",
          basBloodVarietyName: "去白细胞悬浮红细胞",
          effectiveDate: "2025-3-10",
          gatheringDate: "2025-3-10",
          makeDate: "2025-3-10"
        }
      ]
    },
    {
      billNo: 'SIN250210001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250210001',  // 2月10日单据
      createTime: '2025-02-10 11:24:15',
      detail: [
        {
          bloodDonationCode: "",
          basBloodProductCode: "B0022V01",
          basBloodVarietyId: 2,
          abo: "A",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "冰冻血浆2u",
          basBloodVarietyName: "冰冻血浆",
          effectiveDate: "2025-3-11",
          gatheringDate: "2025-3-11",
          makeDate: "2025-3-11"
        }
      ]
    },
    {
      billNo: 'SIN250124001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250124001',  // 1月24日单据
      createTime: '2025-01-24 00:18:24',
      detail: [
        {
          bloodDonationCode: "0201234576791",
          basBloodProductCode: "B0022V02",
          basBloodVarietyId: 3,
          abo: "AB",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "新鲜冰冻血浆2u",
          basBloodVarietyName: "新鲜冰冻血浆",
          effectiveDate: "2025-3-12",
          gatheringDate: "2025-3-12",
          makeDate: "2025-3-12"
        }
      ]
    },
    {
      billNo: 'SIN250122001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250122001',  // 1月22日单据
      createTime: '2025-01-22 22:10:31',
      detail: [
        {
          bloodDonationCode: "0208123456792",
          basBloodProductCode: "B0022V03",
          basBloodVarietyId: 4,
          abo: "O",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "单采血小板2u",
          basBloodVarietyName: "单采血小板",
          effectiveDate: "2025-3-13",
          gatheringDate: "2025-3-13",
          makeDate: "2025-3-13"
        }
      ]
    },
    {
      billNo: 'SIN250120001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250120001',  // 1月20日单据
      createTime: '2025-01-12 13:43:14',
      detail: [
        {
          bloodDonationCode: "0201234567973",
          basBloodProductCode: "B0022V04",
          basBloodVarietyId: 5,
          abo: "A",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "手工分离浓缩血小板2u",
          basBloodVarietyName: "手工分离浓缩血小板",
          effectiveDate: "2025-3-14",
          gatheringDate: "2025-3-14",
          makeDate: "2025-3-14"
        }
      ]
    },
    {
      billNo: 'SIN250118001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250118001',  // 1月18日单据
      createTime: '2025-01-18 08:15:11',
      detail: [
        {
          bloodDonationCode: "0201234567984",
          basBloodProductCode: "B0022V05",
          basBloodVarietyId: 6,
          abo: "AB",
          rhD: "-",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "冷沉淀凝血因子2u",
          basBloodVarietyName: "冷沉淀凝血因子",
          effectiveDate: "2025-10-1",
          gatheringDate: "2025-1-3",
          makeDate: "2025-3-15"
        }
      ]
    },
    {
      billNo: 'SIN250113001',
      billStatus: '已审核',
      storageWay: '手工入库',
      bloodStation: '中心血站',
      bloodBank: 'XB20250113001',  // 1月3日单据
      createTime: '2025-01-03 17:45:33',
      detail: [
        {
          bloodDonationCode: "0201234567895",
          basBloodProductCode: "B0022V06",
          basBloodVarietyId: 7,
          abo: "B",
          rhD: "+",
          volume: 2,
          unit: "u",
          price: 960,
          specialProcessing: "",
          basBloodProductName: "洗涤红细胞2u",
          basBloodVarietyName: "洗涤红细胞",
          effectiveDate: "2025-1-03",
          gatheringDate: "2025-2-04",
          makeDate: "2025-1-03"
        }
      ]
    },
  ].sort((a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime());

const total = ref(0)
checkParam.page = 1;
checkParam.pageSize = 10;
const search = () => { 
  // checkParam.page = page
  // checkParam.pageSize = pageSize
  total.value = alllist.value.length;
  list.value = [...alllist.value.slice((checkParam.page -1 ) * checkParam.pageSize,checkParam.page * checkParam.pageSize)]

}

defineExpose({ search })


</script>

<style lang='scss' scoped>
</style>